Assignment 4: Due Sunday, 16 September at 23:59PM

For help with Rmarkdown for reports, see this white paper from Carnegie Mellon University’s Department of Statistics and Data Science.

For each the seven statistical distributions we covered in the last assignment (Normal, Student’s \(t\), \(\chi ^ 2\), \(F\), Binomial, Negative Binomial, and Poisson),

  1. Generate and store a random vector of 10,000 observations, using the same parameters as the last homework:
    1. \(N(\mu = 2, \sigma ^ 2 = 5 )\),
xN_n10000 <- rnorm(n = 10000, mean = 2, sd = sqrt(5))    
ii. $t_{\nu = 4}$,
xT_n10000 <- rt(n = 10000, df = 4)
iii. $\chi^2_{\nu = 2}$,
xC_n10000 <- rchisq(n = 10000, df = 2)
iv. $F_{n = 90,\ m = 12}$,
xF_n10000 <- rf(n = 10000, df1 = 90, df2 = 12)
v. $Bin(n = 9, p = 2/3)$,
xB_n10000 <- rbinom(n = 10000, size = 9, prob = (2/3))
vi. $NBin(n = 5, p = 1/2)$, and
xNB_n10000 <- rnbinom(n = 10000, size = 5, prob = 0.5)
vii. $Pois(\lambda = 3)$.
xP_n10000 <- rpois(n = 10000, lambda = 3)
  1. Subset the first \(N = 6\) values from the vector, and of this subset
##Normal
    ####i. calculate the 5-Number Summary,
summary(xN_n10000[1:6])
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## -1.99447  0.09004  1.44216  1.74643  3.08475  6.31714
    ####ii. plot the histogram of the subset, and
hist(xN_n10000[1:6])

    ####iii. plot the estimated density of this subset.
plot(density(xN_n10000[1:6]))

##Student's t
    ####i. calculate the 5-Number Summary,
summary(xT_n10000[1:6])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -1.5473 -0.7207 -0.2972 -0.3200  0.1969  0.7223
    ####ii. plot the histogram of the subset, and
hist(xT_n10000[1:6])

    ####iii. plot the estimated density of this subset.
plot(density(xT_n10000[1:6]))

##Chi^2
    ####i. calculate the 5-Number Summary,
summary(xC_n10000[1:6])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## 0.06456 0.36721 0.94934 1.03746 1.07687 2.96898
    ####ii. plot the histogram of the subset, and
hist(xC_n10000[1:6])

    ####iii. plot the estimated density of this subset.
plot(density(xC_n10000[1:6]))

##F
    ####i. calculate the 5-Number Summary,
summary(xF_n10000[1:6])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.6782  0.9092  1.3204  1.5141  2.1427  2.5768
    ####ii. plot the histogram of the subset, and
hist(xF_n10000[1:6])

    ####iii. plot the estimated density of this subset.
plot(density(xF_n10000[1:6]))

##Binomial
    ####i. calculate the 5-Number Summary,
summary(xB_n10000[1:6])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    5.00    6.25    7.00    6.50    7.00    7.00
    ####ii. plot the histogram of the subset, and
hist(xB_n10000[1:6])

    ####iii. plot the estimated density of this subset.
plot(density(xB_n10000[1:6]))

##Negative Binomial
    ####i. calculate the 5-Number Summary,
summary(xNB_n10000[1:6])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   1.750   4.000   3.333   4.750   6.000
    ####ii. plot the histogram of the subset, and
hist(xNB_n10000[1:6])

    ####iii. plot the estimated density of this subset.
plot(density(xNB_n10000[1:6]))

##Poisson
    ####i. calculate the 5-Number Summary,
summary(xP_n10000[1:6])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00    1.25    2.50    3.00    3.75    8.00
    ####ii. plot the histogram of the subset, and
hist(xP_n10000[1:6])

    ####iii. plot the estimated density of this subset.
plot(density(xP_n10000[1:6]))

  1. Repeat Item 2 for the first \(N = 10,\ 20,\ 30,\ \text{and}\ 50\) values from the random vector you generated in Item 1. Remark on the changing behaviour as the sample size increases.
##Normal
####N = 10
    ####i. calculate the 5-Number Summary,
summary(xN_n10000[1:10])
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## -1.99447  0.09004  2.86552  2.03371  3.53734  6.31714
    ####ii. plot the histogram of the subset, and
hist(xN_n10000[1:10])

    ####iii. plot the estimated density of this subset.
plot(density(xN_n10000[1:10]))

####N = 20
    ####i. calculate the 5-Number Summary,
summary(xN_n10000[1:20])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -4.5142  0.3075  1.5635  1.8290  3.8686  6.3171
    ####ii. plot the histogram of the subset, and
hist(xN_n10000[1:20])

    ####iii. plot the estimated density of this subset.
plot(density(xN_n10000[1:20]))

####N = 30
    ####i. calculate the 5-Number Summary,
summary(xN_n10000[1:30])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -4.5142  0.8408  2.1593  2.1464  4.0233  6.3171
    ####ii. plot the histogram of the subset, and
hist(xN_n10000[1:30])

    ####iii. plot the estimated density of this subset.
plot(density(xN_n10000[1:30]))

####N = 50
    ####i. calculate the 5-Number Summary,
summary(xN_n10000[1:50])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -7.9187  0.4079  1.7047  1.5875  3.4823  6.7251
    ####ii. plot the histogram of the subset, and
hist(xN_n10000[1:50])

    ####iii. plot the estimated density of this subset.
plot(density(xN_n10000[1:50]))

#### As the sample size increases, for example, where n = 20, it appears that the curve is smoothing out a bit and looks more similar to the expected Normal curve compared to n = 10.  However, at n = 50, the curve still has some bumps in the curve but overall the shape resembles an expected Normal distribution.  As far as the histograms, the data appears to tend more towards what we would expect for a normal curve as n increases.  However, for n =50, it looks like the left hand side of the graph (up until 4 on the x-axis) resembles a normal distribution; however, the left hand side strays a bit from what we would expect.
##Student's t
####N = 10
    ####i. calculate the 5-Number Summary,
summary(xT_n10000[1:10])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -1.5473 -0.9309 -0.2972  0.1865  0.6125  4.1109
    ####ii. plot the histogram of the subset, and
hist(xT_n10000[1:10])

    ####iii. plot the estimated density of this subset.
plot(density(xT_n10000[1:10]))

####N = 20
    ####i. calculate the 5-Number Summary,
summary(xT_n10000[1:20])
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## -1.54730 -1.05892 -0.65765 -0.21876  0.02439  4.11085
    ####ii. plot the histogram of the subset, and
hist(xT_n10000[1:20])

    ####iii. plot the estimated density of this subset.
plot(density(xT_n10000[1:20]))

####N = 30
    ####i. calculate the 5-Number Summary,
summary(xT_n10000[1:30])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -2.5839 -1.0603 -0.4714 -0.2219  0.5364  4.1109
    ####ii. plot the histogram of the subset, and
hist(xT_n10000[1:30])

    ####iii. plot the estimated density of this subset.
plot(density(xT_n10000[1:30]))

####N = 50
    ####i. calculate the 5-Number Summary,
summary(xT_n10000[1:50])
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## -2.58387 -0.83896 -0.18049  0.02746  0.68027  4.11085
    ####ii. plot the histogram of the subset, and
hist(xT_n10000[1:50])

    ####iii. plot the estimated density of this subset.
plot(density(xT_n10000[1:50]))

#### As the sample size increases, it appears that the curve is smoothing out a bit and looks more similar to the expected t distribution curve compared to n = 10. When n= 10, there graph looks like it has more density around the tails than would be expected.  However, at n = 50, the curve still has some bumps in the tails of the curve but overall the shape resembles an expected t distribution.  As far as the histograms, the data appears to tend more towards what we would expect for a t curve as n increases.  For n = 50, the histogram looks pretty similar to what we would expect for this t distribution with the highest frequency of entries between 0 and 1.
##Chi^2
####N = 10
    ####i. calculate the 5-Number Summary,
summary(xC_n10000[1:10])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## 0.06389 0.36721 0.99102 1.02648 1.12971 2.96898
    ####ii. plot the histogram of the subset, and
hist(xC_n10000[1:10])

    ####iii. plot the estimated density of this subset.
plot(density(xC_n10000[1:10]))

####N = 20
    ####i. calculate the 5-Number Summary,
summary(xC_n10000[1:20])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## 0.06389 0.26452 0.95015 1.11656 1.10097 6.29820
    ####ii. plot the histogram of the subset, and
hist(xC_n10000[1:20])

    ####iii. plot the estimated density of this subset.
plot(density(xC_n10000[1:20]))

####N = 30
    ####i. calculate the 5-Number Summary,
summary(xC_n10000[1:30])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## 0.06389 0.29889 0.98647 1.31146 1.77246 6.29820
    ####ii. plot the histogram of the subset, and
hist(xC_n10000[1:30])

    ####iii. plot the estimated density of this subset.
plot(density(xC_n10000[1:30]))

####N = 50
    ####i. calculate the 5-Number Summary,
summary(xC_n10000[1:50])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## 0.02468 0.35564 0.98647 1.47048 2.38424 6.29820
    ####ii. plot the histogram of the subset, and
hist(xC_n10000[1:50])

    ####iii. plot the estimated density of this subset.
plot(density(xC_n10000[1:50]))

#### As the sample size increases, it appears that the curve begins to look more similar to the expected chi^2 distribution curve compared to n = 10. When n= 10, there graph does not drop off as rapidly as would be expected.  However, at n = 50, the curve has very bumps in the tail of the curve but overall the shape resembles an expected chi^2 distribution.  As far as the histograms, the data appears to tend more towards what we would expect for a chi^2 distribution as n increases.  When n=10, the histogram hardly resembles a chi^2 distribution.  For n = 50, the histogram looks pretty similar to what we would expect for this chi^2 distribution with the highest frequency of entries between 0 and 1.
##F
####N = 10
    ####i. calculate the 5-Number Summary,
summary(xF_n10000[1:10])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.6782  0.8220  1.0119  1.2669  1.4475  2.5768
    ####ii. plot the histogram of the subset, and
hist(xF_n10000[1:10])

    ####iii. plot the estimated density of this subset.
plot(density(xF_n10000[1:10]))

####N = 20
    ####i. calculate the 5-Number Summary,
summary(xF_n10000[1:20])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.5721  0.7948  1.1183  1.2214  1.5452  2.5768
    ####ii. plot the histogram of the subset, and
hist(xF_n10000[1:20])

    ####iii. plot the estimated density of this subset.
plot(density(xF_n10000[1:20]))

####N = 30
    ####i. calculate the 5-Number Summary,
summary(xF_n10000[1:30])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.5320  0.7594  1.1183  1.2195  1.4908  2.7372
    ####ii. plot the histogram of the subset, and
hist(xF_n10000[1:30])

    ####iii. plot the estimated density of this subset.
plot(density(xF_n10000[1:30]))

####N = 50
    ####i. calculate the 5-Number Summary,
summary(xF_n10000[1:50])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.4461  0.7754  1.1183  1.2255  1.3997  3.4974
    ####ii. plot the histogram of the subset, and
hist(xF_n10000[1:50])

    ####iii. plot the estimated density of this subset.
plot(density(xF_n10000[1:50]))

#### As the sample size increases, it appears that the curve is smoothing out a bit and looks more similar to the expected F distribution curve compared to n = 10. When n= 10, there graph looks like it has more density and bumps around the tails than would be expected.  However, at n = 50, the curve still has some bumps in the tail of the curve but overall the shape resembles an expected F distribution.  As far as the histograms, the data appears to tend more towards what we would expect for a normal curve as n increases.  For n = 50, the histogram looks pretty similar to what we would expect for this F distribution with the highest frequency of entries at around 1.
##Binomial
####N = 10
    ####i. calculate the 5-Number Summary,
summary(xB_n10000[1:10])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    4.00    5.25    7.00    6.40    7.00    8.00
    ####ii. plot the histogram of the subset, and
hist(xB_n10000[1:10])

    ####iii. plot the estimated density of this subset.
plot(density(xB_n10000[1:10]))

####N = 20
    ####i. calculate the 5-Number Summary,
summary(xB_n10000[1:20])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    4.00    6.00    7.00    6.65    7.00    9.00
    ####ii. plot the histogram of the subset, and
hist(xB_n10000[1:20])

    ####iii. plot the estimated density of this subset.
plot(density(xB_n10000[1:20]))

####N = 30
    ####i. calculate the 5-Number Summary,
summary(xB_n10000[1:30])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   4.000   6.000   7.000   6.533   7.000   9.000
    ####ii. plot the histogram of the subset, and
hist(xB_n10000[1:30])

    ####iii. plot the estimated density of this subset.
plot(density(xB_n10000[1:30]))

####N = 50
    ####i. calculate the 5-Number Summary,
summary(xB_n10000[1:50])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     4.0     5.0     6.0     6.3     7.0     9.0
    ####ii. plot the histogram of the subset, and
hist(xB_n10000[1:50])

    ####iii. plot the estimated density of this subset.
plot(density(xB_n10000[1:50]))

#### As the sample size increases, it appears that the curve is smoothing out a bit and looks more similar to the expected binomial distribution curve compared to n = 10. When n= 10, the graph is not very smooth but the overall shape is similar to the expected normal curve approximation of a binomial distribution.  However, at n = 50, the curve has a similar shape to the expected normal approximation.  As far as the histograms, the data appears to tend more towards what we would expect for a normal curve as n increases.  However, for n = 50, the histogram still looks quite sparse compared to what we would expect for a binomial distribution.  
##Negative Binomial
####N = 10
    ####i. calculate the 5-Number Summary,
summary(xNB_n10000[1:10])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00    0.25    4.00    3.40    4.75   10.00
    ####ii. plot the histogram of the subset, and
hist(xNB_n10000[1:10])

    ####iii. plot the estimated density of this subset.
plot(density(xNB_n10000[1:10]))

####N = 20
    ####i. calculate the 5-Number Summary,
summary(xNB_n10000[1:20])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     0.0     2.0     4.0     4.4     6.0    11.0
    ####ii. plot the histogram of the subset, and
hist(xNB_n10000[1:20])

    ####iii. plot the estimated density of this subset.
plot(density(xNB_n10000[1:20]))

####N = 30
    ####i. calculate the 5-Number Summary,
summary(xNB_n10000[1:30])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   2.000   4.000   4.633   6.000  12.000
    ####ii. plot the histogram of the subset, and
hist(xNB_n10000[1:30])

    ####iii. plot the estimated density of this subset.
plot(density(xNB_n10000[1:30]))

####N = 50
    ####i. calculate the 5-Number Summary,
summary(xNB_n10000[1:50])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00    2.00    4.00    4.78    7.00   12.00
    ####ii. plot the histogram of the subset, and
hist(xNB_n10000[1:50])

    ####iii. plot the estimated density of this subset.
plot(density(xNB_n10000[1:50]))

#### As the sample size increases, it appears that the curve is smoothing out a bit and looks more similar to the expected approximation curve with p =(2/3). When n= 10, there graph has more bumps in the tails than would be expected.  However, at n = 50, the curve still has some bumps in the tail of the curve but overall the shape resembles an expected negative binomial distribution.  As far as the histograms, the data appears to tend more towards what we would expect for a normal curve as n increases.  For n = 50, the histogram looks pretty similar to what we would expect for this distribution.
##Poisson
####N = 10
    ####i. calculate the 5-Number Summary,
summary(xP_n10000[1:10])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00    2.00    3.50    3.60    4.75    8.00
    ####ii. plot the histogram of the subset, and
hist(xP_n10000[1:10])

    ####iii. plot the estimated density of this subset.
plot(density(xP_n10000[1:10]))

####N = 20
    ####i. calculate the 5-Number Summary,
summary(xP_n10000[1:20])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00    2.00    3.00    3.30    4.25    8.00
    ####ii. plot the histogram of the subset, and
hist(xP_n10000[1:20])

    ####iii. plot the estimated density of this subset.
plot(density(xP_n10000[1:20]))

####N = 30
    ####i. calculate the 5-Number Summary,
summary(xP_n10000[1:30])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   1.250   3.000   3.067   4.000   8.000
    ####ii. plot the histogram of the subset, and
hist(xP_n10000[1:30])

    ####iii. plot the estimated density of this subset.
plot(density(xP_n10000[1:30]))

####N = 50
    ####i. calculate the 5-Number Summary,
summary(xP_n10000[1:50])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00    2.00    3.00    3.08    4.00    8.00
    ####ii. plot the histogram of the subset, and
hist(xP_n10000[1:50])

    ####iii. plot the estimated density of this subset.
plot(density(xP_n10000[1:50]))

#### As the sample size increases, it appears that the curve is smoothing out a bit and looks more similar to the expected Poisson distribution curve compared to n = 10. When n= 10, there graph has many more bumps and dips than would be expected.  However, at n = 50, the curve in general resembles the shape of an expected Poisson distribution.  As far as the histograms, the data appears to tend more towards what we would expect for a Poisson curve as n increases.  However, for n = 50, the histogram still does not look exactly like what we would expect for this distribution.
  1. Repeat Item 2 for the entire vector (\(N = 10000\)). For smaller values of \(N\) from continuous distributions, which tool do you think gave a better representation of the full data: histogram or density plot? Did this change when you inspected the discrete distributions?
##Normal
    ####i. calculate the 5-Number Summary,
summary(xN_n10000)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -7.9187  0.5347  2.0062  2.0515  3.5650 10.1234
    ####ii. plot the histogram of the subset, and
hist(xN_n10000)

    ####iii. plot the estimated density of this subset.
plot(density(xN_n10000))

####At n = 10000, the data is nicely represented in the histogram, but also nicely approximated in the density plot since the data is assumed to be normal.
##Student's t
    ####i. calculate the 5-Number Summary,
summary(xT_n10000)
##       Min.    1st Qu.     Median       Mean    3rd Qu.       Max. 
## -10.261849  -0.751816  -0.000670  -0.006977   0.745523  14.939672
    ####ii. plot the histogram of the subset, and
hist(xT_n10000)

    ####iii. plot the estimated density of this subset.
plot(density(xT_n10000))

####For n = 10000, the data is nicely represented in the histogram.  It is also nicely approximated in the density plot since the data is assumed to be normal and the t distribution is similar to the normal distribution.
##Chi^2
    ####i. calculate the 5-Number Summary,
summary(xC_n10000)
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
##  0.000338  0.606236  1.401541  2.009112  2.793110 17.375296
    ####ii. plot the histogram of the subset, and
hist(xC_n10000)

    ####iii. plot the estimated density of this subset.
plot(density(xC_n10000))

####For n = 10000, this density plot looks very similar to what we would expect of a Chi^2 distribution with this number of df.  The data is nicely represented in the histogram, but also nicely approximated in the density plot since while the data is skewed, the n is large. 
##F
    ####i. calculate the 5-Number Summary,
summary(xF_n10000)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.2517  0.7812  1.0422  1.1974  1.4335 10.2371
    ####ii. plot the histogram of the subset, and
hist(xF_n10000)

    ####iii. plot the estimated density of this subset.
plot(density(xF_n10000))

####For n = 10000, this density plot looks very similar to what we would expect of a F distribution with this number of df.  The data is nicely represented in the histogram, but also nicely approximated in the density plot since while the data is skewed, the n is large.  
##Binomial
    ####i. calculate the 5-Number Summary,
summary(xB_n10000)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   5.000   6.000   6.029   7.000   9.000
    ####ii. plot the histogram of the subset, and
hist(xB_n10000)

    ####iii. plot the estimated density of this subset.
plot(density(xB_n10000))

####For n = 10000, this density plot is not a good representation of the binomial distribution.  Since this is discrete, the density plot function makes assumptions that the data is normalized and poorly represents it.  The histogram is a better representation of the data. 
##Negative Binomial
    ####i. calculate the 5-Number Summary,
summary(xNB_n10000)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   3.000   4.000   4.993   7.000  25.000
    ####ii. plot the histogram of the subset, and
hist(xNB_n10000)

    ####iii. plot the estimated density of this subset.
plot(density(xNB_n10000))

####For n = 10000, this density plot is not a good representation of the negative binomial distribution.  Since this is discrete data, the density plot function makes assumptions that the data is normalized and poorly represents it.  The histogram is a better representation of the data. 
##Poisson
    ####i. calculate the 5-Number Summary,
summary(xP_n10000)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   2.000   3.000   2.999   4.000  13.000
    ####ii. plot the histogram of the subset, and
hist(xP_n10000)

    ####iii. plot the estimated density of this subset.
plot(density(xP_n10000))

####For n = 10000, this density plot is not a good representation of the Poisson distribution.  The density plot function makes assumptions that the data is normalized and poorly represents it.  The histogram is a better representation of the data. 

####For small sample sizes and continuous distributions it is better to use a density plot if the data is symmetric and not skewed.  However, if the data is skewed, the density plot cannot handle it for small sample sizes.  With large sample sizes for both skewed and not skewed continuous data, the density plot is better than a histogram. For discrete distributions at all sample sizes, a histogram is best.
  1. Contrast the 5-Number Summaries at each of the sample sizes (6, 10, 20, 30, 50, and 10000) for the skewed distributions vs. the symmetric distributions.
####For the skewed distributions, as the sample size increases the mean takes longer (n must increase more) before it reaches the expected value compared to the symmetric distribution.  For example at n = 50, the mean for the normal distribution is 1.98 which is very close to the expected value of 2.  However, at n = 50, the mean for the Chi^2 distribution is 1.82 which is much farther from the expected value 2.  With a distributiion with the same variance, if your skewness is lower your mean will be closer to what is expected.

xN_n10000 <- rnorm(n = 10000, mean = 2, sd = sqrt(5))    
xT_n10000 <- rt(n = 10000, df = 4)
xC_n10000 <- rchisq(n = 10000, df = 2)
xF_n10000 <- rf(n = 10000, df1 = 90, df2 = 12)
xB_n10000 <- rbinom(n = 10000, size = 9, prob = (2/3))
xNB_n10000 <- rnbinom(n = 10000, size = 5, prob = 0.5)
xP_n10000 <- rpois(n = 10000, lambda = 3)

summary(xN_n10000[1:6])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -1.9753 -0.7962  0.4307  0.1609  1.1505  1.8942
summary(xN_n10000[1:10])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -1.9753 -0.8588  0.4307  0.5080  1.7433  3.5049
summary(xN_n10000[1:20])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -2.5389 -1.1913  0.7274  0.9337  2.0502  7.0369
summary(xN_n10000[1:30])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -2.5389 -0.2427  1.4060  1.2824  2.4372  7.0369
summary(xN_n10000[1:50])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -2.5389  0.1947  2.1311  1.9828  3.5631  7.0369
summary(xN_n10000[1:10000])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -6.9570  0.4744  1.9926  2.0084  3.5218 10.1036
summary(xT_n10000[1:6])
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## -0.02733  0.05613  0.29214  0.35298  0.60882  0.86913
summary(xT_n10000[1:10])
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## -0.07890  0.01777  0.29213  0.72850  0.82153  3.81859
summary(xT_n10000[1:20])
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## -1.23018 -0.09726  0.29213  0.48029  0.97763  3.81859
summary(xT_n10000[1:30])
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## -1.28098 -0.07397  0.32195  0.44411  1.10356  3.81859
summary(xT_n10000[1:50])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
## -2.3715 -0.2565  0.1876  0.2841  0.7612  3.9259
summary(xT_n10000[1:10000])
##       Min.    1st Qu.     Median       Mean    3rd Qu.       Max. 
## -27.213875  -0.737451  -0.003618  -0.014748   0.738346  19.071357
summary(xC_n10000[1:6])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.1949  0.9738  1.7096  1.7457  2.6686  3.1434
summary(xC_n10000[1:10])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.1949  0.6851  1.3455  1.7669  2.6686  4.8347
summary(xC_n10000[1:20])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.1949  0.6139  1.3455  2.1408  3.0920  6.8588
summary(xC_n10000[1:30])
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## 0.001971 0.611145 1.316156 1.826544 2.668604 6.858755
summary(xC_n10000[1:50])
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## 0.001971 0.540821 1.206357 1.796958 2.871877 6.858755
summary(xC_n10000[1:10000])
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
##  0.000103  0.572304  1.360672  1.987278  2.779964 23.124797
summary(xF_n10000[1:6])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.6827  0.8237  1.4117  1.4055  1.7896  2.3838
summary(xF_n10000[1:10])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.5114  0.6972  0.9471  1.1575  1.6136  2.3838
summary(xF_n10000[1:20])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.5114  0.8012  1.3054  1.3769  1.7635  2.9869
summary(xF_n10000[1:30])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.4656  0.7600  1.1900  1.2852  1.5215  2.9869
summary(xF_n10000[1:50])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.3620  0.8189  1.2306  1.3418  1.7896  2.9869
summary(xF_n10000[1:10000])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.2533  0.7879  1.0559  1.1997  1.4395  7.9375
summary(xB_n10000[1:6])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   4.000   5.000   5.000   5.167   5.750   6.000
summary(xB_n10000[1:10])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     4.0     5.0     6.0     5.8     6.0     8.0
summary(xB_n10000[1:20])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    3.00    5.00    6.00    5.80    6.25    8.00
summary(xB_n10000[1:30])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##       3       5       6       6       7       8
summary(xB_n10000[1:50])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    3.00    5.00    6.00    5.94    7.00    8.00
summary(xB_n10000[1:10000])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   1.000   5.000   6.000   6.021   7.000   9.000
summary(xNB_n10000[1:6])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   4.000   6.000   6.667  10.250  13.000
summary(xNB_n10000[1:10])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     0.0     4.0     5.5     6.4     9.5    13.0
summary(xNB_n10000[1:20])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00    3.75    4.50    5.65    8.00   13.00
summary(xNB_n10000[1:30])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   3.000   4.000   5.367   7.750  13.000
summary(xNB_n10000[1:50])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00    3.00    4.00    5.36    7.75   14.00
summary(xNB_n10000[1:10000])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   3.000   4.000   4.995   7.000  22.000
summary(xP_n10000[1:6])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   2.000   3.250   4.000   3.667   4.000   5.000
summary(xP_n10000[1:10])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     2.0     2.0     3.5     3.2     4.0     5.0
summary(xP_n10000[1:20])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    1.00    2.00    3.50    3.45    4.00    8.00
summary(xP_n10000[1:30])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   2.000   3.000   3.233   4.000   8.000
summary(xP_n10000[1:50])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00    2.00    3.00    2.96    4.00    8.00
summary(xP_n10000[1:10000])
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   2.000   3.000   2.983   4.000  11.000